<!--
 * @Author: zhangweinan
 * @Date: 2023-07-27 10:25:55
 * @LastEditors: zhangweinan
 * @LastEditTime: 2023-07-27 11:04:03
 * @Description: file content
 * @FilePath: \cty-admin\src\views\order\myOrder\index.vue
-->
<template>
  <div class="main-page">
    <PageSearch
      :search-form-config="searchFormConfig"
      :form-data.sync="formData"
      @searchBtnClick="handleSearch"
    />
    <PageContent
      ref="pageContent"
      :form-data="formData"
      :content-table-config="contentConfig"
    >
      <template #operate="{ row }">
        <el-button
          type="text"
          size="small"
          icon="el-icon-view"
          @click="previewOrder(row)"
        >
          查看
        </el-button>
      </template>
    </PageContent>
    <!-- 订单详情 -->
    <order-info :order-id="orderId" :show.sync="showOrderInfo"></order-info>
  </div>
</template>

<script>
import { contentConfig } from "./config/content.config";
import { searchFormConfig } from "./config/search.config";
import OrderInfo from "./orderInfo.vue";
export default {
  name: "OrderList",
  components: {
    OrderInfo,
  },
  data() {
    return {
      orderId: "",
      showOrderInfo: false,
      contentConfig,
      searchFormConfig,
      btnLoading: false,
      confirmBtnLoading: false,
      dialogVisible: false,
      formData: {}, // 搜索表单数据
      modalFormData: {}, // 模态框表单数据
    };
  },
  mounted() {},
  methods: {
    handleSearch() {
      this.$refs.pageContent.queryTblMain();
    },
    previewOrder({ orderId }) {
      this.orderId = "";
      this.$nextTick(() => {
        this.orderId = orderId;
        this.showOrderInfo = true;
      });
    },
    editOrder(row) {
      row.statusValue = +row.statusValue;
      this.dialogVisible = true;
      this.modalFormData = { ...this.modalFormData, ...row };
    },
  },
};
</script>
